function inttohex(p_digit) { switch (p_digit & 0xf) { case 0: return("0"); case 1: return("1"); case 2: return("2"); case 3: return("3"); case 4: return("4"); case 5: return("5"); case 6: return("6"); case 7: return("7"); case 8: return("8"); case 9: return("9"); case 10:return("A"); case 11:return("B"); case 12:return("C"); case 13:return("D"); case 14:return("E"); case 15:return("F"); } return("X"); } function urlencode(p_string) { if (p_string == null) return(""); var len = p_string.length; var retstr = ""; for (var i=0; i= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) { retstr += c; } else if (uc < 256) { retstr += "%"; retstr += inttohex((uc >> 4) & 0xf); retstr += inttohex(uc & 0xf); } else { retstr += "|u"; retstr += inttohex((uc >> 4) & 0xf); retstr += inttohex(uc & 0xf); retstr += inttohex((uc >> 12) & 0xf); retstr += inttohex((uc >> 8) & 0xf); } } return(retstr); } function cws(p_string) { if (p_string == null) return(""); var len = p_string.length; var retstr = ""; for (var i=0; i= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) retstr += c; else if (uc == 0x09 || uc == 0x0a || uc == 0x0d || (uc >= 0x20 && uc <=0x7e) || (uc >= 0x80 && uc <=0xd7ff) || (uc >= 0xe000 && uc <=0xf8ff) || (uc >= 0xf900 && uc <=0xfffd) || (uc >= 0x10000 && uc <=0x10ffff)) retstr += "&#"+uc+";"; else retstr += "?"; } return(retstr); } function validateEmail(p_emailAddr) { var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; if(reg.test(p_emailAddr) == false) { alert("Invalid Email Address!"); return(false); } else { return(true); } } String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } String.prototype.ltrim = function() { return this.replace(/^\s+/,""); } String.prototype.rtrim = function() { return this.replace(/\s+$/,""); } String.prototype.startsWith=function(prefix){ return this.substring(0,prefix.length)==prefix; } String.prototype.endsWith=function(suffix){ return this.substring(this.length-suffix.length)==suffix; }